<?php
session_start();
include_once 'core/function.general.php';
checkIfLoggedIn();
include_once 'core/function.users.php';
include_once 'core/function.banner.php';
include_once 'core/function.mainmenu.php';
$manager = new userManagement();

if (isset($_GET['mode'])) {
    $mode = $_GET['mode'];
} else {
    $mode = "";
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="hu" lang="hu">

<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="author" content="Galicz Miklós" />
    <meta name="copyright" content="Copyright 2011" />
    <meta name="Designer" content="Galicz Miklós" />
    <meta name="title" content="Ideális Ingatlan Iroda Kft." />
    <link rel="stylesheet" type="text/css" href="css/reset.css" />
    <link rel="stylesheet" type="text/css" href="css/general.css" />
    <link rel="stylesheet" type="text/css" href="css/usermanager.css" />
    <link rel="shortcut icon" type="image/x-icon" href="imgs/favicon.ico" />
    <?php
switch ($mode) {
    case "profileimg":
?>
    <link href="/libs/upload/uploadify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/libs/jquery-1.6.2.min.js"></script>
    <script type="text/javascript" src="/libs/upload/swfobject.js"></script>
    <script type="text/javascript" src="/libs/upload/jquery.uploadify.v2.1.4.min.js"></script>
    <script type="text/javascript">
				$(function() {
				$('#file_upload').uploadify({
  'uploader'  : '/libs/upload/uploadify.swf',
        'script'    : '/core/function.upload.profile.php',
        'cancelImg' : '/libs/upload/cancel.png',
        'folder'    : '/images/profile/<?php echo $_GET['uid'] ?>',
  'multi'          : false,
  'auto'           : true,
  'fileExt'        : '*.jpg;*.gif;*.png',
  'fileDesc'       : 'Image Files (.JPG, .GIF, .PNG)',
  'queueID'        : 'custom-queue',
  'queueSizeLimit' : 1,
  'simUploadLimit' : 1,
  'removeCompleted': false,
  'onSelectOnce'   : function(event,data) {
      $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
    },
  'onAllComplete'  : function(event,data) {
      $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
    }
});				});
				</script>

            <?php
        break;
    default:
        break;
}
?>
	<title>IRA-MS/Felhasználó kezelés</title>
 </head>
 <body>
 <div id="wrapper">
    <?php
banner();
?>
   <div id="leftCol">
    <?php
mainMenu();
?>
 </div>
 <div id="rightCol">
    <?php
switch ($mode) {
    case "newuser":
        if (!isset($_POST['submit'])) {
            $manager->userForm();
        } else {
            $manager->newUser();
        }
        break;
    case "newjob":
        if (!isset($_POST['submit'])) {
            $manager->createJobForm();
        } else {
            $manager->createJobAction();
        }
        break;
    case "assignpos":
        if (!isset($_POST['submit'])) {
            $manager->setJobForm($_GET['uid']);
        } else {
            $manager->setJobAction();
        }
        break;
    case "edit":
        if (!isset($_POST['submit'])) {
            $manager->editUser($_GET['uid']);
        } else {
            $manager->editUserAction();
        }
        break;
    case "assigndist":
        if (!isset($_POST['assignSubmit'])) {
            $manager->assignUserDistrictForm($_GET['uid']);
        } else {
            $manager->assignUserDistrictAction();
        }
        break;
    case "deleteuser":
        $manager->deleteUser($_GET['uid']);
        break;
    case "activate":
        $manager->activateUser($_GET['uid']);
        break;
    case "profileimg":
        $manager->newUserAction();
?>
        <div id="profileImg"><img src="core/function.pimage.download.php?mode=thumb&uid=<?php echo
        $_GET['uid']; ?>" /></div>
        <div class="box">
        <div id="status-message">Select some files to upload:</div>
<input id="file_upload" type="file" name="Filedata" />
<div id="custom-queue"></div>
</div>
        <?php
        break;
    case "deletedusers":
        $manager->deletedUsers();
        break;
    case "viewuser":
        $manager->viewUserDetail($_GET['uid']);
        break;
    case "listpositions":
        $manager->listPositions();
        break;
    default:
        $manager->overview();
        break;
}

?>
</div>
 </div>
 </body>
 </html>